<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>退赔记录</title>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/default/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/icon.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/demo.css"/>
    	
	<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.easyui.min.js"></script>
	<script src="${pageContext.request.contextPath}/plugins/jQuery/easyui-lang-zh_CN.js"></script>
	<script src="${pageContext.request.contextPath }/admin/js/easyui_mergecell.js"></script>
	<script type="text/javascript">
	
	   $(function(){
	   
	        $('#station').combobox({
				valueField:'station_id', //值字段
				textField:'station_name', //显示的字段
				url:'${pageContext.request.contextPath }/admin/station/findStationByKind/1',
				onLoadSuccess : function(data) {
		            $('#station').combobox("setValue",-1);
	        	}
	        });

			loadTable();
			
	    });
		
		function loadTable(){
			var sortFlag = false;
			$('#dg').datagrid({
				rownumbers:true,
				singleSelect:true,
		 		url:'${pageContext.request.contextPath }/admin/return/liststationreturn',
		 		queryParams:{
		 			 startDate:$("#start_time").textbox('getValue'),
		 			 endDate:$("#end_time").textbox('getValue'),
		 			 stationid:$("#station").combobox('getValue')
		 		},
		 		rowStyler: function(index,row){
					if (row.station_name=="站点合计"){
		//				return 'background-color:#6293BB;color:#fff;font-weight:bold;';
						return 'font-weight:bold;';
					}
				},
	    		columns:[[
	    		    {field:'station_name',title:'服务站',align:'center',width:250,rowspan:2,formatter: function (value, row, index) {
						var res=row.station_name;
						if(row.station_name!="站点合计"){
							res=row.station_name+"<br/>（站长："+row.username+" 手机号："+row.mobile+"）";
						}					
						return res;
					}},
	    		    {field:'order_date',title:'退赔订单日期',align:'center',rowspan:2,width:110},
	    		    {field:'ordernums',title:'总销售件数',align:'center',rowspan:2,width:80},    		    
	    		    {field:'orderamounts',title:'总销售金额',align:'center',rowspan:2,width:100},
	    		    {title:'残次退赔',colspan:3},
	    		    {title:'整件退赔',colspan:3} 		    					
	 			],[
	 				{field:'ccnums',title:'退赔件数',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.ccnums=="0件"?"":row.ccnums;
					}},
	    		    {field:'ccamounts',title:'退赔金额',align:'center',rowspan:1,width:100,formatter: function (value, row, index) {				
						return row.ccamounts=="￥0.00"?"":row.ccamounts;
					}},
	    		    {field:'ccrate',title:'退赔率',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.ccrate=="0%"?"":row.ccrate;
					}},
	    		    {field:'zjnums',title:'退赔件数',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.zjnums=="0件"?"":row.zjnums;
					}},
	    		    {field:'zjamounts',title:'退赔金额',align:'center',rowspan:1,width:100,formatter: function (value, row, index) {				
						return row.zjamounts=="￥0.00"?"":row.zjamounts;
					}},
	    		    {field:'zjrate',title:'退赔率',align:'center',rowspan:1,width:80,formatter: function (value, row, index) {				
						return row.zjrate=="0%"?"":row.zjrate;
					}},
	 			]],
				onLoadSuccess:function(data){  
			     	if(!sortFlag) $(this).datagrid("autoMergeCells",['station_name']);
				}
			});
		}
		
		function findData(){
			loadTable();
		}
		
		function refresh(){
			loadTable();
		}
		
		function toExcel(){
			$('#ff').submit();
		}
		
	</script>
	<style type="text/css">
		body{
		font-family:'微软雅黑';}
	</style>
  </head>
  
  <body>
	<table id="dg" toolbar="#searchtool" loadMsg="正在查询..." style="width:1100px;height:auto;"></table>
	
	<div id="searchtool" style="padding:5px; height:auto;">
		<form action="${pageContext.request.contextPath}/admin/return/exportReturnListByStation" method="post" id="ff">  
	       	<span style="margin:0px 12px;">开始时间:</span><input id="start_time" class="easyui-datebox" name="startDate" style="width:120px" value="${currDate }">  
	       	<span style="margin:0px 12px;">结束时间：</span><input id="end_time" class="easyui-datebox" name="endDate" style="width:120px" value="${currDate }">
	       	<span style="margin:0px 12px;">服务站:</span><input id="station" class="easyui-textbox" name="stationid" style="width:160px;height:26px"/> 
	       	<a href="javascript:findData()" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width:100px;margin:0px 3px;">查询</a>
	       	<a href="javascript:refresh()" class="easyui-linkbutton" data-options="iconCls:'icon-my-refresh'" style="width:100px;margin:0px 3px;">刷新</a>
	       	<a href="javascript:toExcel()" class="easyui-linkbutton" data-options="iconCls:'icon-my-save'" style="width:100px;margin:0px 3px;">导出Excel</a>
    	</form>
    </div>
  </body>
</html>
